import store from '@store'
export function beforeEach (to, from, next) {
  // keepAlive
  store.commit('keepAlive', to.meta.keepAlive)
  next()
}

export function afterEach (to) {
  try {
    /** 匹配菜单start */
    const path = to.path
    store.state.menu.map((v, i) => {
      v.list.map((val, j) => {
        if (path === val.path) {
          store.commit('activeTab', `${i + 1}-${j + 1}`)
        }
      })
    })
    /** 匹配菜单end */
    document.title = to.meta.title || 'accumulation'
  } catch (e) { console.log(e) }
}
